package Database;

import java.sql.Connection;
import java.sql.Statement;
import javax.swing.JOptionPane;
import oracle.jdbc.pool.OracleDataSource;

public class HapusAllTabel {

    public static void main(String[] args) {
        String url = "jdbc:oracle:thin:@localhost:1521:XE";
        String name = "hr";
        String pass = "12345";
        Connection con;
        try {
            OracleDataSource ods = new OracleDataSource();
            ods.setURL(url);
            con = ods.getConnection(name, pass);
            Statement stat = con.createStatement();
            String user = "drop table USER_PENERIMA";
            stat.executeQuery(user);
            String sekre = "drop table USER_SEKRETARIAT";
            stat.executeQuery(sekre);
            String surat = "drop table SURAT";
            stat.executeQuery(surat);
            String dokumen = "drop table DOKUMEN";
            stat.executeQuery(dokumen);
            JOptionPane.showMessageDialog(null, "Koneksi OK" + "\nTabel dan Seluruh Data telah dihapus");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Error :" + e.getMessage());
        }
    }
}
